我在尝试安装 PowerShell virtualenvwrapper 时遇到问题。
以下是我正在经历的过程:
/*****
经验丰富的 Python/Django 开发人员通常选择在独立的 Python 虚拟环境中运行他们的 Python 应用程序。
这些允许开发人员在一台计算机上拥有多个不同的 Django 环境,从而允许他们创建新网站(使用最新版本的 Django),同时仍然维护依赖于旧版本的网站。
Django 开发团队本身建议您使用 Python 虚拟环境。
*****/
1.以管理员身份访问 PowerShell
cd C:\
mkdir Django
cd Django
2. 获取 Python 3.5.2(我建议使用 32 位)- https://www.python.org/downloads/release/python-352/
Customize the location: C:\Python35-32
(make sure is installed in your path)
安装 Python 后, 打开 PowerShell 窗口并
python
这就是您将看到的内容:
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
--------------------(CTRL + Z 退出 Python 提示符)
3.获取点
将以下脚本保存为 get-pip.py:
https://bootstrap.pypa.io/get-pip.py (如果找不到,请向我要一份)
python get-pip.py
要检查一切是否正常,只需在命令行中输入 pip:
pip
然后,如果一切顺利,
pip install --upgrade setuptools
pip install ez_setup
4.安装virtualenv和virtualenvwrapper-powershell
pip install virtualenv
(一切都好)
pip install virtualenvwrapper-powershell
(这里有问题)
C:\Django>pip install virtualenvwrapper-powershell
Collecting virtualenvwrapper-powershell
Using cached virtualenvwrapper-powershell-12.7.8.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\USERHP~1\AppData\Local\Temp\pip-build-9qxnn_l2\virtualenvwrapper-powershell\setup.py", line 76
TOKEN_READ = 0x00020000L | 0x0008
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in
C:\Users\USERHP~1\AppData\Local\Temp\pip-build-9qxnn_l2\virtualenvwrapper-powershell\
我在这里能做什么?
感谢您的支持
最佳答案
virtualenvwrapper-powershell 与 Python 2.7 交互良好。 (https://pypi.python.org/pypi/virtualenvwrapper-powershell/2.7.1)
因此,我建议将其安装为系统 python,然后在路径之外安装 Python 3.5.2。
以下步骤:
在路径上安装 Python 2.7
安装 Python 3.5.2 关闭路径
-
pip
pip install --upgrade setuptools
pip install ez_setup
-
pip install virtualenv
-
pip install virtualenvwrapper-powershell
关于Windows 上的 Python(开发环境): Install Python 3. 5.2、pip 和 virtualenv,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41588417/