我正在使用macOS(10.13.3)并安装了Python v 3.6.4
我正在尝试按照此Mozilla文章的说明进行操作:https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/development_environment
我的流程:
1 which python
»/usr/local/bin/python
注意,在我做符号链接ln -s /usr/local/bin/python3 /usr/local/bin/python
2 python3 -V
»Python 3.6.4
3 sudo -H pip3 install virtualenvwrapper
»
Requirement already satisfied: virtualenvwrapper in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
Requirement already satisfied: stevedore in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from virtualenvwrapper)
Requirement already satisfied: virtualenv in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from virtualenvwrapper)
Requirement already satisfied: virtualenv-clone in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from virtualenvwrapper)
Requirement already satisfied: pbr!=2.1.0,>=2.0.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from stevedore->virtualenvwrapper)
Requirement already satisfied: six>=1.10.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from stevedore->virtualenvwrapper)
4 nano .bash_profile
»添加以下内容:»
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH
export WORKON_HOME=$HOME/.virtualenvs
# export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 # No impact
# export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3 # No impact
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python # No impact
# VIRTUALENVWRAPPER_PYTHON=`which python` # No impact
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh
5 source ~/.bash_profile
6 mkvirtualenv my_django_environment
»
Running virtualenv with interpreter /usr/local/bin/python
Using base prefix '/usr/local/bin/../../../Library/Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/myuser/.virtualenvs/my_django_environment/bin/python
ERROR: The executable /Users/myuser/.virtualenvs/my_django_environment/bin/python is not functioning
ERROR: It thinks sys.prefix is '/Library/Frameworks/Python.framework/Versions/3.6' (should be '/Users/myuser/.virtualenvs/my_django_environment')
ERROR: virtualenv is not compatible with this system or executable
7 Facepalm
我的.bash_profile文件的完整内容:
# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh
我猜我的问题与以下内容有关,但我不知道这意味着什么,也不知道如何修复它,有人可以帮帮我吗?
ERROR: The executable /Users/myuser/.virtualenvs/my_django_environment/bin/python is not functioning
ERROR: It thinks sys.prefix is '/Library/Frameworks/Python.framework/Versions/3.6' (should be '/Users/myuser/.virtualenvs/my_django_environment')
ERROR: virtualenv is not compatible with this system or executable
提前致谢!
答案 0 :(得分:1)
我不完全确定,但我认为运行以下内容解决了我的问题:
import commonjs from 'rollup-plugin-commonjs';
import resolve from 'rollup-plugin-node-resolve';
export default {
input: 'main.js',
output: {
file: 'bundle.js',
format: 'cjs',
},
plugins: [commonjs({ include: ['./main.js', './node_modules/*.*'] }),
resolve(),],
};
答案 1 :(得分:0)
很好,你设法解决了这个问题。
虽然暂时使用了mkvirtualenv
,但如果您还没有,我建议您尝试使用Pipenv
。
Pipenv
记录您在virtualenv中使用的python版本,而virtualenvwrapper
(通过pip freeze
)则不记录。